package cn.itcast.springmvc.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

/**
 * 在整体架构中，为Handler
 * 在具体实现中，为Controller
 * @author joedy
 *
 */
public class HelloController implements Controller {

	/**
	 * 处理具体业务逻辑
	 * 返回值ModelAndView
	 */
	@Override
	public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
		// 假装处理业务逻辑
		ModelAndView mv = new ModelAndView();
		mv.setViewName("hello");
		mv.addObject("msg", "springmvc的第一个程序！");
		return mv;
	}

}
